import router from "./router";
// 页面切换时修改网页标题   拦截器
router.beforeEach(function(to, from, next) {
  // 切换title
  document.title = to.meta.title;
  const isLogin = localStorage.token ? true : false;
  if (to.path === "/login") {
    next();
  } else {
    isLogin ? next() : next("/login");
  }
  // console.log(router.push("/home"))
  // console.log(router)
  // if (!localStorage.token) return next("/login");
});
